Skip to content

Conversation

@rrudakov
Copy link
Contributor

I don't understand what should be written in the last section "Semantic Interpretation in clojure-ts-mode". The example of syntax highlighting exists in the "Syntax highlighting" section.

@rrudakov rrudakov force-pushed the feature/finish-design-docs branch 2 times, most recently from 3b7dc3b to 1b56922 Compare May 27, 2025 15:20
@rrudakov
Copy link
Contributor Author

Just in case, pinging @bbatsov :)

@bbatsov
Copy link
Member

bbatsov commented May 27, 2025

I don't understand what should be written in the last section "Semantic Interpretation in clojure-ts-mode".

Basically it should be an explanation what gets treated a deserving special indentation and font-locking compared to regular function call forms or data forms. (e.g. how do we decide that something a macro call that has a body) In our case that's done via the configuration you've recently introduced, but we could have also extracted this information from parsed definitions - e.g. if a form takes a body param or special metadata we might generate on the fly some special font-locking and indentation rules for it. (although I guess we won't be working in such a direction)

@rrudakov rrudakov force-pushed the feature/finish-design-docs branch from 1b56922 to 25f856f Compare May 27, 2025 15:39
@rrudakov
Copy link
Contributor Author

but we could have also extracted this information from parsed definitions - e.g. if a form takes a body param or special metadata we might generate on the fly some special font-locking and indentation rules for it. (although I guess we won't be working in such a direction)

I was thinking about it and I couldn't come up with a design for such a feature. We would need a way to describe the entire form's syntax somehow, produce a query and inject it to treesit-font-lock-settings somehow. All the queries must be precompiled, otherwise it will be really slow, so I'm not sure there is an easy and efficient way to implement this.

@rrudakov
Copy link
Contributor Author

Once it's merged, I think #73 can be closed.

@rrudakov rrudakov requested a review from bbatsov May 27, 2025 15:48
@bbatsov bbatsov merged commit 2dd7ed2 into clojure-emacs:main May 27, 2025
@rrudakov rrudakov deleted the feature/finish-design-docs branch May 27, 2025 15:51
@bbatsov
Copy link
Member

bbatsov commented May 27, 2025

I was thinking about it and I couldn't come up with a design for such a feature. We would need a way to describe the entire form's syntax somehow, produce a query and inject it to treesit-font-lock-settings somehow. All the queries must be precompiled, otherwise it will be really slow, so I'm not sure there is an easy and efficient way to implement this.

I was thinking something similar, that's why I have doubts we'll ever work in this direction. It's much easier to extract such information from the runtime (as CIDER does).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants